//
//  GoodsStoreCell.m
//  MobileShoppingMall
//
//  Created by 冯传昌 on 2021/4/20.
//  Copyright © 2021 冯传昌. All rights reserved.
//

#import "GoodsStoreCell.h"

@interface GoodsStoreCell()

@property (nonatomic,strong) UIImageView *storeLogoImg;//商店logo

@property (nonatomic,strong) UILabel *storeNameLB;//商店名称

@property (nonatomic,strong) UILabel *storeInfoLB;//商店简介

@property (nonatomic,strong) UIButton *storeBtn;//进店看看

@end

@implementation GoodsStoreCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self initUI];
    }
    return self;
}

#pragma mark - setter
- (void)setModel:(GoodsDetailModel *)model{
    _model = model;
    [self.storeLogoImg sd_setImageWithURL:[NSURL URLWithString:_model.logo] placeholderImage:LoadImage(@"")];
    self.storeNameLB.text = _model.company;
    self.storeInfoLB.text = _model.companyDescription;
}

#pragma mark - UI
-(void)initUI{
    [self.contentView addSubview:self.storeLogoImg];
    [self.contentView addSubview:self.storeNameLB];
    [self.contentView addSubview:self.storeInfoLB];
    [self.contentView addSubview:self.storeBtn];
}
#pragma mark - lazy
- (UIImageView *)storeLogoImg{
    if (!_storeLogoImg) {
        _storeLogoImg = [[UIImageView alloc] initWithFrame:CGRectMake(18, 9, 42, 42)];
        _storeLogoImg.clipsToBounds = YES;
        _storeLogoImg.layer.cornerRadius = 21;
    }
    return _storeLogoImg;
}

- (UILabel *)storeNameLB{
    if (!_storeNameLB) {
        _storeNameLB = [[UILabel alloc] initWithFrame:CGRectMake(self.storeLogoImg.right+10, 12, ScreenWidth/2+50, 21)];
        _storeNameLB.textColor = MainBlackTextColor;
        _storeNameLB.font = FontSet(15);
        _storeNameLB.textAlignment = NSTextAlignmentLeft;
        _storeNameLB.text = @"";
    }
    return _storeNameLB;
}

- (UILabel *)storeInfoLB{
    if (!_storeInfoLB) {
        _storeInfoLB = [[UILabel alloc] initWithFrame:CGRectMake(self.storeLogoImg.right+10, self.storeLogoImg.bottom-18, ScreenWidth/2+80, 15)];
        _storeInfoLB.textColor = MainGrayTextColor;
        _storeInfoLB.font = FontSet(11);
        _storeInfoLB.textAlignment = NSTextAlignmentLeft;
        _storeInfoLB.text = @"专营进出口澳洲各种货物，经营范围…";
    }
    return _storeInfoLB;
}

- (UIButton *)storeBtn{
    if (!_storeBtn) {
        _storeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _storeBtn.frame = CGRectMake(ScreenWidth-90, 17, 74, 26);
        _storeBtn.clipsToBounds = YES;
        _storeBtn.layer.cornerRadius = 13;
        _storeBtn.layer.borderWidth = 1;
        _storeBtn.layer.borderColor = RGB(255, 178, 31).CGColor;
        [_storeBtn setTitle:@"进店看看" forState:normal];
        [_storeBtn setTitleColor:RGB(255, 178, 31) forState:normal];
        [_storeBtn.titleLabel setFont:FontSet(13)];
        [_storeBtn addTarget:self action:@selector(toStoreClick) forControlEvents:UIControlEventTouchUpInside];
    }
    return _storeBtn;
}

#pragma mark - SEL
//进店看看
-(void)toStoreClick{
    
}


@end
